<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>下单</title>
</head>
<script type="text/javascript" src="/js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
    function flashsale() {
        $.ajax({
            // 隐藏真实URL
            url: "/order",
            type: "POST",
            data: "userId=u12345&content=hi.book&productId=12",
            cache: false,
            success: function (data) {
                if (data.data === "success") {
                    window.location.href = "/watingpay";
                } else {
                    alert("抢购失败，请重试！")
                }
            },
            error: function () {
            }
        });
    }
</script>
<body>
<img src="images/img.jpg"><br/>
<input type="button" value="抢购" onclick="flashsale()"/>
</body>
</html>